<!DOCTYPE html>
<html>
    <head>
        <style type="text/css"> 
            #div{
                width:100px;
                height:100px;
                outline:red dotted 20px;/*给div加外围线*/
                background-color:darkgray;
                }
        </style>
    </head>
    <body>
        <div id="div"></div>
        <span>div添加外围线不会占用空间，会盖住文字</span>
    </body>
</html>